<%@page import="com.wanmait.cookbook.vo.Pager"%>
<%@page import="com.wanmait.cookbook.vo.Works"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<ul class="cook-list" id="count">
<%
	String path=request.getContextPath();
%>
						
						<!--作品的一个展示  -->
				<%
				String name=(String)request.getAttribute("name");
                List<Works> burryWorkss=(List<Works>)request.getAttribute("workss");
				if(burryWorkss.size()==0){
					%>
					<span>没有相关作品</span>
					<%
				}else{
                List<Integer> burryCounts=(List<Integer>)request.getAttribute("worksCount");
                for(int i=0;i<burryWorkss.size();i++){
                %>

						<li class="clearfix"><a class="cook-img"
							href="<%=path %>/HotWorksServlet?action=showWorks&worksId=<%=burryWorkss.get(i).getId() %>"
							style="background-size: cover; position: relative;"
							title="<%=burryWorkss.get(i).getInfo() %>" target="_blank"
							one-link-mark="yes"> <img
								src="<%=path%>/static/image/<%=burryWorkss.get(i).getPic() %>"
								width="180" height="125"
								title="<%=burryWorkss.get(i).getInfo() %>">
						</a>
							<div class="cook-info">
								<a class="cookname text-lips "
									href="<%=path %>/HotWorksServlet?action=showWorks&worksId=<%=burryWorkss.get(i).getId() %>"
									target="_blank" one-link-mark="yes"><%=burryWorkss.get(i).getTitle() %></a>
								<!-- <p class="major">嫩豆腐,里脊肉,蒜,葱,油,老抽,盐,水,水淀粉 </p> -->
								 <span><%=burryWorkss.get(i).getInfo() %></span>
								<div class="score">
								
								
								</div>
								<div class="aut-num clearfix text-lips ">
									<a class="headicon"
										href="<%=path %>/PersonalServlet?action=init&id=<%=burryWorkss.get(i).getUserinfo().getId() %>"
										target="_blank" one-link-mark="yes"> <img
										src="<%=path%>/static/image/<%=burryWorkss.get(i).getUserinfo().getAvatar() %>"><%=burryWorkss.get(i).getUserinfo().getName() %>
									</a> <a class="proicon" href="#"
										target="_blank" one-link-mark="yes"> 
									</a>
										<span style="" class="nickname text-lips">点赞<%=burryCounts.get(i) %>
							<a href="javascriptt:void(0)">
								<img class="likeHeart" width="20" src="<%=path%>/img/kongxin.jpg">
							</a>
						</span>
								</div>
							</div></li>
			<%} 
				}
			%>
						<!--一个作品展示结束  -->

							
					</ul>
				<!--分页数字开始  -->
					<div class="mt20">
						<div class="pages">
							<!-- <a  href="http://www.douguo.com/caipu/%E5%AE%B6%E5%B8%B8%E8%8F%9C/0/0"
								class="atou hide" one-link-mark="yes">首页</a> -->
								<%
									Pager pager=(Pager)request.getAttribute("pager");
								int start = 1;
								int end = pager.getPageCount();
								if(pager.getPageCount()>5)
								{
									start = pager.getPageNo()-2<1?1:pager.getPageNo()-2;
									end = start+4;
									if(end>pager.getPageCount())
									{
										end = pager.getPageCount();
										start = end-4;
									}
								}
								%><a href="javascript:void(0)" class="prevPager" one-link-mark="yes">上一页</a>
								<% for(int i=start;i<=end;i++){
									if(i==pager.getPageNo()){
										%>
										<a href="javascript:void(0)" style="color:red" class="aliaon" one-link-mark="yes"><%=i %></a>
										<% 
									}else{
										%>
										<a href="javascript:void(0)" class="aliaon" one-link-mark="yes"><%=i %></a>
										<%
										}
									} %>
									<a href="javascript:void(0)" class="nextPager" one-link-mark="yes">下一页</a>
									<a href="javascript:void(0)" class="aliaon" one-link-mark="yes"><%=pager.getPageNo() %>/<%=pager.getPageCount() %></a>
							<!-- 分页结束 -->
									<!-- 上下页事件开始 -->
<script type="text/javascript">
$(function(){
	//上一页点击事件
	$(".prevPager").click(function(){
		var n=<%=pager.getPageNo()%>;
		$.ajax({
			url:"<%=path%>/FindBoxServlet",
			data:{action:"countWorks",pageNo:n-1,name:"<%=name%>"},
			success:function(mes){
				$("#showList").html(mes);
			}
			
		});
	});
	//下一页点击事件
	$(".nextPager").click(function(){
		var n=<%=pager.getPageNo()%>;
		$.ajax({
			url:"<%=path%>/FindBoxServlet",
			data:{action:"countWorks",pageNo:n+1,name:"<%=name%>"},
			success:function(mes){
				$("#showList").html(mes);
			}
			
		});
	});

})
</script>	
<!--上下页事件结束  -->							
					